package live.betterman.system.service.impl;

import live.betterman.system.model.SysRole;
import live.betterman.system.dao.SysRoleMapper;
import live.betterman.system.service.SysRoleService;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.hutool.core.util.StrUtil;

import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhudawei
 * @since 2023-12-27
 */
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {
    
    @Override
    public IPage<SysRole> page(Page<SysRole> page, String roleName) {
        LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
        if (StrUtil.isNotEmpty(roleName)) {
            queryWrapper.like(SysRole::getRoleName, roleName);
        }
        return page(page, queryWrapper);
    }
}
